package com.link2room.ironhide.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by sss on 2016/9/13.
 */
@Entity
@Table(name = "hotel_min_price", catalog = "")
@DynamicInsert
public class HotelMinPrice extends BaseEntity{
    public enum HotelMinPrice_{
        minPrice,rsvDate,pbChannel
    }
    /**
     * 最低价
     */
    private BigDecimal minPrice;
    /**
     * 预定日期
     */
    private Date rsvDate;
    /**
     * 发布渠道
     */
    private String pbChannel;

    @Basic
    @Column(name = "min_price", nullable = false, precision = 2)
    public BigDecimal getMinPrice() {
        return minPrice;
    }

    public void setMinPrice(BigDecimal minPrice) {
        this.minPrice = minPrice;
    }

    @Basic
    @Column(name = "rsv_date", nullable = false)
    public Date getRsvDate() {
        return rsvDate;
    }

    public void setRsvDate(Date rsvDate) {
        this.rsvDate = rsvDate;
    }

    @Basic
    @Column(name = "pb_channel", nullable = false, length = 16)
    public String getPbChannel() {
        return pbChannel;
    }

    public void setPbChannel(String pbChannel) {
        this.pbChannel = pbChannel;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        HotelMinPrice that = (HotelMinPrice) o;

        if (minPrice != null ? !minPrice.equals(that.minPrice) : that.minPrice != null) return false;
        if (rsvDate != null ? !rsvDate.equals(that.rsvDate) : that.rsvDate != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = minPrice != null ? minPrice.hashCode() : 0;
        result = 31 * result + (rsvDate != null ? rsvDate.hashCode() : 0);
        return result;
    }
}
